<clr-datagrid (clrDgRefresh)="refresh($event)">
  <clr-dg-column [clrDgField]="'name'">
    <ng-container *clrDgHideableColumn="showState['name']">
      名称
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-version">
    <ng-container *clrDgHideableColumn="showState['label']">
      标签
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-version">
    <ng-container *clrDgHideableColumn="showState['containers']">
      镜像
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['status']">
      容器状态
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-time">
    <ng-container *clrDgHideableColumn="showState['age']">
      已创建
    </ng-container>
  </clr-dg-column>


  <clr-dg-row *ngFor="let deployment of deployments" [clrDgItem]="deployment">
    <clr-dg-action-overflow>
      <button class="action-item" (click)="detailDeployment(deployment)">编辑</button>
      <button class="action-item" (click)="migrationDeployment(deployment)">迁移</button>
    </clr-dg-action-overflow>
    <clr-dg-cell>{{deployment.objectMeta.name}}</clr-dg-cell>
    <clr-dg-cell class="col-version">
      <div *ngFor="let label of deployment.objectMeta.labels | keyvalue" class="version-text">
        <a href="javascript:" (click)="versionDetail(label.key + ': ' + label.value)">{{label.key}}: {{label.value}}</a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell class="col-version">
      <div *ngFor="let container of deployment.containers" class="version-text">
        <a href="javascript:" (click)="versionDetail(container)">{{container}}</a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell>
      {{deployment.pods.current}}/{{deployment.pods.desired}}
      <clr-icon style="color: #FF3434" shape="exclamation-triangle" *ngIf="deployment.pods.current !== deployment.pods.desired"
                class="is-solid"></clr-icon>
      <clr-icon style="color: green" shape="success-standard" *ngIf="deployment.pods.current === deployment.pods.desired"
                class="is-solid"></clr-icon>
    </clr-dg-cell>
    <clr-dg-cell class="col-time">{{deployment.objectMeta.creationTimestamp | relativeTime}}</clr-dg-cell>
  </clr-dg-row>

  <wayne-paginate
    [(currentPage)]="currentPage"
    [total]="page.totalCount"
    [pageSizes]="[10, 20, 50]"
    (sizeChange)="pageSizeChange($event)">
  </wayne-paginate>
</clr-datagrid>
